<?php

namespace App\Models\Workflow;

use App\Models\BaseModel;
use App\Models\Traits\KfSoftDeletes;
use App\Models\Traits\KfUid;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany;

class WorkflowTemplateModel extends BaseModel
{
    use KfUid;
    use KfSoftDeletes;

    protected $table = 'workflow_templates';

    protected $fillable = [
        'name',
        'workflowType',
        'status',
        'isDeleted'
    ];

    const STATUS_ON   = 1;
    const STATUS_OFF  = 0;
    const STATUS_TEXT = [
        self::STATUS_ON  => '启用',
        self::STATUS_OFF => '停用',
    ];


    public function nodesRel(): HasMany
    {
        return $this->hasMany(WorkflowTemplateNodeModel::class, 'workflowTemplateId', 'id');
    }
}
